#! /bin/bash

echo "Build RK3288..."

pro_file="$PWD"/src/zllocker.pro
echo ${pro_file}

build_dir="./build-rk3288"
if [ ! -d "$build_dir" ]; then 
    mkdir "$build_dir"
fi
cd ./build-rk3288

# check rk3288 env
echo checking build enviroment
if [ ! $RK3288ROOT ]; then
    echo "no rk3288 env params"
    exit 1
fi

# export rk3288 env
export PATH="$RK3288ROOT"/bin:$PATH
export PATH="$RK3288ROOT"/lib:$PATH
export LD_LIBRARY_PATH=$RK3288ROOT/lib

# run qmake
echo "Running qmake...."
arm_qmake="/home/xjx/QtEnv/QtEmbedded-5.9.4-arm/bin/qmake"
# if [ ! -x "$arm_qmake" ]; then
#     echo "$arm_qmake is not existed"
#     exit 1
# fi

"$arm_qmake" "$pro_file"

# make
make -j6
